<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:rich="http://richfaces.org/rich">

<ui:composition
	template="#{webGlobal.url_template}/administration/main.xhtml">
	<ui:define name="head">

	</ui:define>

	<ui:define name="content">

		<div class="panel panel-default">
			<div class="panel-heading">Liste des tournois</div>

			<table class="table">
				<thead>
					<tr>
						<th>Non du tournoi</th>
						<th>Nombre d'&eacute;quipes</th>
						<th>&Eacute;tat</th>
						<th>Actions</th>
					</tr>
				</thead>
				<tbody>
					<ui:repeat var="tournamentVar"
						value="#{tournamentList.listTournament}">
						<tr>
							<td>#{tournamentVar.name}</td>
							<td>#{tournamentList.teambyTournament[tournamentVar]}</td>
							<td>#{tournamentVar.status}</td>
							<td><h:form>
									<h:commandButton action="#{tournamentList.viewTournament(tournamentVar)}"
										image="#{webGlobal.url_module}/tournament/img/loupe-icon.png"
											style="height: 20px;width:20px; vertical-align:top;">
									</h:commandButton>
									<h:commandButton action="#{tournamentList.editTournament(tournamentVar)}"
										image="#{webGlobal.url_module}/tournament/img/referee-icon.png"
											style="height: 20px;width:20px; vertical-align:top;">
									</h:commandButton>
									<h:commandButton action="#{tournamentList.deleteTournament(tournamentVar)}"
										image="#{webGlobal.url_module}/tournament/img/delete-icon.png"
										style="height: 20px;width:20px; vertical-align:top;">
									</h:commandButton>
								</h:form>
							</td>
						</tr>
					</ui:repeat>
					<tr></tr>
				</tbody>
			</table>
		</div>

		<h:form styleClass="form-signin" prependId="false">
			<h:outputLabel for="nameTournament">Nom</h:outputLabel>
			<h:message for="nameTournament" style="color: red;" />
			<h:inputText id="nameTournament" label=" " styleClass="form-control"
				required="true" value="#{tournamentList.tournament.name}" requiredMessage="Le nom doit etre renseigné">
			</h:inputText>

			<h:outputLabel for="placeTournament">Lieu</h:outputLabel>
			<h:message for="placeTournament" style="color: red;" />
			<h:inputText id="placeTournament" label=" " styleClass="form-control"
				required="true" value="#{tournamentList.tournament.place}" requiredMessage="Le lieu doit etre renseigné"/>

			<h:outputLabel for="startDate">Date de début (yyyy-mm-dd)</h:outputLabel>
			<h:message for="startDate" style="color: red;" />
			<h:inputText id="startDate" label=" " styleClass="form-control"
				required="true" value="#{tournamentList.startDateString}" requiredMessage="La date n'est pas valide">
				<f:convertDateTime pattern="yyyy-MM-dd" />
			</h:inputText>

			<h:outputLabel for="pauseDurationTournament">Durée de la pause</h:outputLabel>
			<h:message for="pauseDurationTournament" style="color: red;" />
			<h:inputText id="pauseDurationTournament" label=" "
				styleClass="form-control" required="true"
				value="#{tournamentList.tournament.pauseDuration}" />

			<h:outputLabel for="halfTimeDurationTournament">Durée d'une mi-temps</h:outputLabel>
			<h:message for="halfTimeDurationTournament" style="color: red;" />
			<h:inputText id="halfTimeDurationTournament" label=" "
				styleClass="form-control" required="true"
				value="#{tournamentList.tournament.halfTimeDuration}" />

			<h:outputLabel for="prolongationDurationTournament">Durée de la prolongation</h:outputLabel>
			<h:message for="halfTimeDurationTournament" style="color: red;" />
			<h:inputText id="prolongationDurationTournament" label=" "
				styleClass="form-control" required="true"
				value="#{tournamentList.tournament.prolongationDuration}" />

			<br />

			<h:commandButton value="Ajouter tournoi"
				styleClass="btn btn-lg btn-primary btn-block"
				action="#{tournamentList.addTournament()}">
			</h:commandButton>
		</h:form>

	</ui:define>
</ui:composition>
</html>